<?php


namespace app\api\model\mysql;


use app\common\model\TimeModel;

class MallUserPaylog extends TimeModel
{
    protected $deleteTime = 'delete_time';

    /**
     * 根据openid与订单号查询支付记录
     * @param string $openid
     * @param int $order_id
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getUserPaylogByOpenid(string $openid='',int $order_id=0){
        return $this->field('*')
            ->where("openid",$openid)
            ->where("order_id",$order_id)
            ->find();
    }

    /**
     * 查询指定订单号
     * @param string $ordersn
     * @return array|\think\Model|null
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getUserPaylogByOrdersn(string $ordersn=''){
        return $this->field('*')
            ->where("ordersn",$ordersn)
            ->find();
    }

}